<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		
		<button onclick="newDoc()">加载新文档</button>
		
		<script>
			//返回整个页面的URL
			document.write(location.href);
			//返回URL路径名
			document.write(location.pathname);
			//加载新的文档
			function newDoc(){
				window.location.assign("https://www.baidu.com");
			}
		</script>
	</body>
</html>